package cn.cloud.butler.webapi.controller;

import cn.cloud.butler.webapi.domain.ResponseEntity;
import cn.cloud.butler.webapi.service.MultiMachineTimeStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@EnableAutoConfiguration
public class TodayMacStateController {

    @Autowired
    MultiMachineTimeStatisticsService multiMachineTimeStatisticsService;

    @RequestMapping(method = RequestMethod.GET,value = "/HncWeb/AllMacStateCurrent.action")
    public ResponseEntity AllMacStateCurrent(){
        ResponseEntity responseEntity = new ResponseEntity();
        List<HashMap<String,Object>> result = multiMachineTimeStatisticsService.allMacStateCurrentAndInfo();
        if(result.size()<=0){
            responseEntity.setMsgCode(1);
            responseEntity.setMsgDesc("查询失败");
        }else{
            responseEntity.setMsgCode(0);
            responseEntity.setMsgDesc("查询成功");
            responseEntity.setData(result);
        }
        return responseEntity;
    }


}
